

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>${fieldValue(bean:courseInstance, field:'activityId')} - ${fieldValue(bean:courseInstance, field:'name')}</title>
    </head>
    <body>
        <div class="undernav">
            <span class="menuButton"><g:link class="list" action="list">${Inter.printOut('Course List',session.language)}</g:link></span>
            <span class="menuButton"><g:link class="create" action="create">${Inter.printOut('New Course',session.language)}</g:link></span>
            <!-- This is the help button. -->
            <%  def help = Help.findByNameAndLanguage("course_show", session.language)
            def helplink = createLink(action:'show', controller:'help', id: help.id )%>
            <a href="#" onClick="MyWindow=window.open('${helplink}','Help','width=350,height=450'); return false;">${Inter.printOut('Help',session.language)}</a>
            <!-- This is the end of the help button. -->
        </div>
        <div class="body">
          <g:javascript src="jquery.livequery.js" />
          <g:javascript src="budget/editFigures.js" />
          <g:link class=" urlUpdateHours" controller="course" action="updateHours"></g:link>
          <!--

          <h1><b>${fieldValue(bean:courseInstance, field:'activityId')}</b> - ${fieldValue(bean:courseInstance, field:'name')}</h1>
            
          -->
          
          <h2>${Inter.printOut('Courses',session.language)}</h2>

            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <div class="dialog" style="float:left;">
                <!--
                <h2>Details</h2>
                -->

                <h2>${Inter.printOut('Course Details',session.language)}</h2>

                <table>
                    <tbody>
                         <!--<tr class="prop">
                            <td valign="top" class="name">Course code :</td>
                            
                            <td valign="top" class="value">${fieldValue(bean:courseInstance, field:'activityId')}</td>
                            
                        </tr>
                    
                        <tr class="prop">
                            <td valign="top" class="name">Name:</td>
                            
                            <td valign="top" class="value">${fieldValue(bean:courseInstance, field:'name')}</td>
                            
                        </tr>
                        -->
                        <tr class="prop">
                            <td valign="top" class="name">${Inter.printOut('Description',session.language)}:</td>
                            
                            <td valign="top" class="value">${fieldValue(bean:courseInstance, field:'description')}</td>
                            
                        </tr>
                    
                        <tr class="prop">
                            <td valign="top" class="name">${Inter.printOut('Level',session.language)}:</td>
                            
                            <td valign="top" class="value">${Inter.printOut(fieldValue(bean:courseInstance, field:'level'),session.language)}</td>
                            
                        </tr>
                    
                        <tr class="prop">
                            <td valign="top" class="name">${Inter.printOut('Area',session.language)}:</td>
                            
                            <td valign="top" class="value"><g:link controller="area" action="show" id="${courseInstance?.area?.id}">${courseInstance?.area?.encodeAsHTML()}</g:link></td>
                            
                        </tr>
                    </tbody>
                </table>
                <div class="buttons">
                  <g:form>
                      <input type="hidden" name="id" value="${courseInstance?.id}" />
                      <span class="button"><g:actionSubmit class="edit" value="${Inter.printOut('Edit',session.language)}"  action="Edit"/></span>
                      <span class="button"><g:actionSubmit class="delete" onclick="return confirm('${Inter.printOut('Sure',session.language)}');" value="${Inter.printOut('Delete',session.language)}" action="Delete" /></span>
                      
                  </g:form>
                </div>
            </div>
            <div class="dialog" style="float:left; margin-left:20px">
              <br/><h2>${Inter.printOut('Schedules',session.language)}</h2>
              <div class="membersView">                  
                  <table>
                    <tbody>
                      <tr>
                          <th>${Inter.printOut('Date',session.language)}</th>
                          <td>${Inter.printOut('Start Hour',session.language)}</td>
                          <td>${Inter.printOut('End Hour',session.language)}</td>

                      </tr>
                      <g:each var="m" in="${courseInstance.schedules}">
                      <tr>
                          <td>${m?.day()}</td>
                          <td>${m?.startHours()}</td>
                          <td>${m?.endHours()}</td>
                       </tr>
                      </g:each>
                    </tbody>
                  </table>
                  <div class="buttons">
                  <g:form>
                      <input type="hidden" name="id" value="${courseInstance?.id}" />
                      <span class="button"><g:actionSubmit class="add_schedule"  value="${Inter.printOut('Add',session.language)}" action="add_schedule" /></span>
                      <g:if test="${courseInstance.schedules.size() > 0}">
                        <span class="button"><g:actionSubmit action ="delete_schedule" class="delete_schedule" value="${Inter.printOut('Delete',session.language)}" action="Remove schedule" /></span>
                      </g:if>
                   </g:form>
                </div>
              </div>
            </div>
            <div class="dialog" style="float:left; margin-left:20px">
              <br/><h2>${Inter.printOut('Teachers',session.language)}</h2>
              <div class="membersView">
                  <table>
                    <tbody>
                      <tr>
                          <th>${Inter.printOut('Name',session.language)}</th>
                          <th>${Inter.printOut('Hours',session.language)}</th>
                      </tr>
                      <g:each var="m" in="${courseInstance.amountOfHour}">
                      <tr>
                          <td><g:link action="show" controller="employee" id="${m?.member?.id}">${m?.member?.firstName} ${m?.member?.lastName}</g:link></td>
                          <td><span class="hoursFigures" id="updateHours" title="${m?.id}" >${m?.hours}</span></td>
                       </tr>
                      </g:each>
                    </tbody>
                  </table>
                  <div class="buttons">
                  <g:form>
                      <input type="hidden" name="id" value="${courseInstance?.id}" />
                      <span class="button"><g:actionSubmit class="add_employee" value="${Inter.printOut('Add Employee',session.language)}" action ="add_employee" /></span>
                      <g:if test="${numberOfEmployees > 0}">
                        <span class="button"><g:actionSubmit class="delete_employee" value="${Inter.printOut('Remove Employee',session.language)}" action ="delete_employee" /></span>
                      </g:if>
                   </g:form>
                </div>
              </div>
            </div>
            <div class="dialog" style="float:left; margin-left:20px">
              <br/><h2>${Inter.printOut('Participants',session.language)}</h2>
              <div class="membersView">
                  <table>
                    <tbody>
                      <tr>
                          <th>${Inter.printOut('Name',session.language)}</th>
                      </tr>
                      <g:each var="e" in="${courseInstance.allParticipants()}">
                      <tr>
                          <td>
                            <g:link action="show" controller="employee" id="${e?.id}">${e?.firstName} ${e?.lastName}</g:link>
                          </td>
                       </tr>
                      </g:each>
                    </tbody>
                  </table>
                  <div class="buttons">
                  <g:form>
                      <input type="hidden" name="id" value="${courseInstance?.id}" />
                      <span class="button"><g:actionSubmit class="add_participant" value="${Inter.printOut('Add',session.language)}" action="add_participant" /></span>
                      <g:if test="${numberOfParticipants > 0}">
                        <span class="button"><g:actionSubmit class="delete_participant" value="${Inter.printOut('Delete',session.language)}" action="delete_participant" /></span>
                      </g:if>
                   </g:form>
                </div>
              </div>
            </div>
             
            
                
        </div>
    </body>
</html>
